Skip to content

fix(github-ci): reject non-object JSON bodies with 400 in worker (#6946) - #8696

Merged
dezren39 merged 1 commit into
mainfrom
queue/11337-6946-ghci-null-body
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/11337-6946-ghci-null-body

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #6946.

What

The github-ci webhook worker parsed the signed body with JSON.parse guarded only for syntax, then dereferenced payload.repository before the try/catch that produces the receiver-failed envelope. A signed null JSON body (valid JSON, valid HMAC) threw TypeError: null is not an object out of fetch — an unhandled 500 GitHub retries forever. Array/scalar bodies were likewise unguarded.

Fix

pkgs/github-ci/worker/src/index.ts: immediately after JSON.parse, reject any non-object payload (null, array, string, number, boolean) with a deliberate 400 bad payload — for every event type, before any dereference. Object bodies keep today's behavior exactly (ping pong, workflow_run skip/store, push/PR/issues routing, 202 unknown events); malformed JSON keeps the existing 400 bad json.

Tests (oracle: acceptance in #6946 — deliberate 400 for non-object bodies, unchanged routing for objects)

New tests in pkgs/github-ci/worker/test/worker.test.ts, all with correctly HMAC-signed bodies:

  • null body → 400 for workflow_run
  • null body → 400 for push
  • array body [] → 400
  • scalar body "hello" → 400

Verification on the laptop against the PR head: npx vitest run — 33 passed (4 files, existing suite included); npx tsc --noEmit — clean.

Queue: task 11337 (repo-health-code-pilot), lane any-a.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 14:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T14:09:21.546429Z a27beed PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: df7b4943-0b9b-4858-839e-442bc059dbca
Commits

Reviewing files that changed from the base of the PR and between 57bbf2a and a27beed.

Files selected for processing: 2

  • pkgs/github-ci/worker/src/index.ts
  • pkgs/github-ci/worker/test/worker.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

github-ci(worker): a JSON null body crashes fetch — payload.repository dereferences null outside the try/catch, escaping the receiver-failed envelope

1 participant